;(function($,window,document,undefined){
	$.fn.extend({
		topBox:function(){
			$(this).append("<div id='topbox'></div>");
			$("#topbox").append("<div class='navBox clearfix'></div>");
			$(".navBox").append("<ul class='l_list'><li><span>欢迎光临厂家网，</span><a id='loginLink' class='red-da3' href='"+WWW_URL+"/user/login'>请登录</a><a id='loginOut' class='red-da3 ml-5 display-none' href='"+WWW_URL+"/user/logout'>退出</a><a href='"+WWW_URL+"/user/register' target='_blank' class='ml-25'>免费注册</a><a href='http://www.cjwsc.com/appdown' target='_blank' class='ml-25'>移动客户端</a></li></ul>");
			$(".navBox").append("<ul class='r_list'></ul>");
			$(".r_list").append("<li><a href='"+WWW_URL+"' class='red-da3'>厂家网首页</a></li>");
			$(".r_list").append("<li><a href='"+WWW_URL+"/member/member'>我的厂家网</a></li>");
			$(".r_list").append("<li class='on'><a href='"+WWW_URL+"/morder/m_order'><span class='position-re'>我的订单<i class='shanjiao'></i></span></a><div class='downlist'><a href='"+WWW_URL+"/morder/m_order'>所有订单</a><a href='"+WWW_URL+"/morder/m_order?status=0'>待付款</a><a href='"+WWW_URL+"/morder/m_order?status=1'>待发货</a><a href='"+WWW_URL+"/morder/m_order?status=2'>待收货</a></div></li>");
			$(".r_list").append("<li class='on'><a href='http://www.cjwsc.com/page/b_shzc' target='_blank'><span class='position-re'>服务中心<i class='shanjiao'></i></span></a><div class='downlist'><a href='http://www.cjwsc.com/page/b_shzc' target='_blank'>售后服务</a><a href='http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAyMjIyOF8xNjI0MDJfNDAwOTk5MDIxM18yXw' target='_blank'>在线客服</a><a href='http://www.cjwsc.com/page/b_lx' target='_blank'>投诉中心</a></div></li>");
			$(".r_list").append("<li class='mr-10'>|</li>");
			$(".r_list").append("<li class='ipt'><input type='text' placeholder='搜索' class='input J_SearchVal' /><a href='javascript:;' class='sarchBt J_SearchBtn'>搜索</a></li>");
			$(".r_list").append("<input type='hidden' id='user_id' />");
		},
		footBox:function(){
			$(this).append("<div class='sever'></div>");
			$(".sever").append("<div class='foot-box'></div>");
			$(".foot-box").append("<div class='content-box'></div>");
			$(".content-box").append("<div class='warp clearfix'></div>");
			$(".warp").append("<dl><dt><h3>购物指南</h3></dt><dd><a href='http://www.cjwsc.com/page/b_zygw' target='_blank'>怎样购物</a></dd><dd><a href='http://www.cjwsc.com/page/b_jfjh' target='_blank'>积分计划</a></dd><dd><a href='http://www.cjwsc.com/page/b_ddzt' target='_blank'>订单状态</a></dd></dl>");
			$(".warp").append("<dl><dt><h3>支付帮助</h3></dt><dd><a href='http://www.cjwsc.com/page/b_wy' target='_blank'>网银支付</a></dd><dd><a href='http://www.cjwsc.com/page/b_zfb' target='_blank'>支付宝</a></dd><dd><a href='http://www.cjwsc.com/page/b_fpsm' target='_blank'>发票说明</a></dd></dl>");
			$(".warp").append("<dl><dt><h3>配关方式</h3></dt><dd><a href='http://www.cjwsc.com/page/b_kd' target='_blank'>普通快递</a></dd><dd><a href='http://www.cjwsc.com/page/b_ems' target='_blank'>邮政EMS</a></dd></dl>");
			$(".warp").append("<dl><dt><h3>服务条款</h3></dt><dd><a href='http://www.cjwsc.com/page/b_shzc' target='_blank'>售后服务政策</a></dd><dd><a href='http://www.cjwsc.com/page/b_shts' target='_blank'>售后特色服务</a></dd><dd><a href='http://www.cjwsc.com/page/b_thsm' target='_blank'>退换货说明</a></dd><dd><a href='http://www.cjwsc.com/page/b_lx' target='_blank'>联系客服</a></dd></dl>");
			$(".warp").append("<dl><dt><h3>关于厂家网</h3></dt><dd><a href='http://www.cjwsc.com/page/love_cjw' target='_blank'>消费者为何钟情厂家网</a></dd><dd><a href='http://home.cjwsc.com/home.html' target='_blank'>厂家网企业官网</a></dd><dd><a href='http://www.cjwsc.com/page/b_about' target='_blank'>厂家网简介</a></dd><dd><a href='http://www.cjwsc.com/page/b_zp' target='_blank'>招贤纳士</a></dd></dl>");
			$(this).append("<div class='foot-box'><ul class='list_qr'></ul></div>");
			$(".list_qr").append("<li><img src='../../images/qr1.png' class='fl' /><h3>厂家网客户端</h3><p>想想都喜欢，想想都要爱上它了</p><a href='https://itunes.apple.com/cn/app/chang-jia-wang/id916464999?mt=8' target='_blank'><i class='ico1'></i>iPhone</a><a href='http://www.cjwsc.com/appdown/down?type=3' target='_blank'><i class='ico2'></i>Android</a></li>");
			$(".list_qr").append("<li><img src='../../images/qr2.png' class='fl' /><h3>厂家网微信服务号</h3><p>筑梦创业，人人都是CEO，免费福利每天派！</p><p>微信号：cjwsckefu</p></li>");
			$(".list_qr").append("<li><img src='../../images/qr3.png' class='fl' /><h3>厂家网微信订阅号</h3><p>万千优惠资讯抢先收到，尖货好货等你来抢！</p><p>微信号：cjwscscb</p></li>");
			$(this).append("<div class='foot-box'><div class='bz'></div><div class='ft_link'></div><p class='copyright'></p><div class='pic_list'></div></div>");
			$(".bz").append("<img src='../../images/flbz.jpg' />");
			$(".ft_link").append("<a href='http://www.cjwsc.com/page/b_about' target='_blank'>关于我们</a>|<a href='http://www.cjwsc.com/page/b_lx' target='_blank'>联系客服</a>|<a href='http://www.cjwsc.com/page/sup_recruit' target='_blank'>商家入驻</a>|<a href='http://www.cjwsc.com/page/privacy' target='_blank'>隐私保护</a>|<a href='http://www.cjwsc.com/page/duty_rule' target='_blank'>免责条款</a>|<a href='http://m.kuaidi100.com/' target='_blank'>快递查询</a>");
			$(".copyright").append("版权所有 厂家网商城 保留所有版权 ICP备案证书号:粤ICP备12093889号,<a href=''>经营许可证编号：粤B2-20140257</a><br/>Copyright © 2012-2013 www.cjwsc.com,All Rights Reserved");
			$(".pic_list").append("<a href='http://www.315online.com.cn/member/315140014.html' target='_blank'><img src='../../images/315new.gif' /></a><a class='ml-5' href='https://cert.ebs.org.cn/fc9af8b7-e2e0-4eff-b755-91a829d283d5.html' target='_blank'><img src='../../images/VieID_140_50.png' /></a><a class='ml-5' href='https://ss.knet.cn/verifyseal.dll?sn=e15042344030058510u8o5000000&ct=df&a=1&pa=0.694261680370982' target='_blank'><img src='../../images/cnnic.png' /></a><a class='ml-5' href='http://www.ectrustprc.org.cn/certificate.id/certificateb.php?id=20034433' target='_blank'><img src='../../images/bluelogo.gif' /></a><a class='ml-5' href='https://www.anquan.org/authenticate/cert/?site=www.cjwsc.com&at=realname' target='_blank'><img src='../../images/sm_124x47.png' /></a>");
		},
		wapTop:function(){
			$(this).append("<ul class='row-model'></ul>");
			$(".row-model").append("<li class='col15' id='l_1'></li><li class='col70' id='l_2'></li><li class='col15' id='l_3'></li>");
			$("#l_1").append("<a href='' class='logoDiv'><img src='../../images/logo.png' /></a>");
			$("#l_2").append("<div class='searchDiv'><input type='text' placeholder='搜索' class='input_m' id='querywords'  /><a href='javascript:;' class='searchBtn'><img src='../../images/serchBtn.png' /></a></div>");
			$("#l_3").append("<a href='' class='cartNew'><img src='../../images/cartlogo.png' /></a>");
		}
	});
})(jQuery,window,document)
//判断移动端
var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i) ? true: false;
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i) ? true: false;
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true: false;
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i) ? true: false;
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows());
    }
};
$(function(){
	//千城万店优惠券用户ID;
	$(".qcwd_main").append("<input type='hidden' id='user_id' />");
	//PC及wap端头部声明
	if(isMobile.any()){
		$("head").append("<meta name=\"renderer\" content=\"webkit\" /><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" /><meta content=\"width=device-width,initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no\" name=\"viewport\" />");
	}else{
		$("head").append("<link rel=\"icon\" href=\"../../images/favicon.ico\" type=\"image/x-icon\" /><link rel=\"stylesheet\" href=\"css/model.css\">");
	}

	//链接跳转
	function linkJoin(){
		var ua = window.navigator.userAgent.toLowerCase();
		if (ua.indexOf('android') == -1 && ua.indexOf('iphone') == -1) {
		    $(document).on('click', '.C_J_good', function() {
		        var cj_id = $(this).data('id');
		        window.open("http://www.cjwsc.com/item/" + cj_id +".html");
		    })
		}

	}
	linkJoin();

	// 百度统计	
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?d4d44aab359ff090cd63f58f1beb84cd";
	  var s = document.getElementsByTagName("script")[0];
	  s.parentNode.insertBefore(hm, s);
	})();

	//返回顶部
	function backTop(obj){
		$(obj).on("click",function(){
			$('html,body').animate({
				'scrollTop':0
			},300);
		});
	}
});